﻿
app.controller("ngAlbumDetailController", function ($scope, $http, $location, $routeParams) {
    $scope.album;

    $scope.addingAlbumTag = false;

    $http.get("/api/album/detail/" + $routeParams.id).success(function (data) {
        $scope.album = data;
    }).error(function (data) {
        console.log(JSON.stringify(data));
    });

    $scope.addAlbumTag = function (value) {
        var bucket = { tag : value};
        $http.post("/api/tag/album/" + $scope.album.Id, bucket).success(function (data) {
            $scope.album.Tags.push({Name: value});
            $scope.addingAlbumTag = false;
            $scope.newAlbumTag = "";
        }).error(function (data) {
            console.log(JSON.stringify(data));
        });
    };
});